<?php
/**
 * User: litao
 * Date: 2018/6/10
 * Time: 16:48
 */

namespace Block\Model;


use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * 基础model
 */
class BaseModel extends Model{

    use SoftDeletes;//引用软删除

    /**
     * 不可被批量赋值的属性 类似黑名单字段
     * @var array
     */
    protected $guarded=[];

    protected $dates = ['deleted_at'];
    /**
     * 自动格式化时间戳
     * @param \DateTime|int $value
     *
     * @return false|int
     */
    public function fromDateTime($value){
        return strtotime(parent::fromDateTime($value));
    }
}